/**
 * 
 */
package com.tianyadu.security.controller.async;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @FileName: MockQueue
 * @Description: 模拟消息队列信息
 * @author: xueyj
 * @create: 2018-12-05 15:00
 */
@Component
@Slf4j
public class MockQueue {
	/** 创建新订单请求信息 */
	private String placeOrder;
	/** 创建新订单响应信息 */
	private String completeOrder;

	public String getPlaceOrder() {
		return placeOrder;
	}

	public void setPlaceOrder(String placeOrder) throws Exception {
		new Thread(() -> {
			log.info("接到下单请求,【{}】 ", placeOrder);
			try {
				Thread.sleep(1000);
			} catch (Exception e) {
				e.printStackTrace();
			}
			this.completeOrder = placeOrder;
			log.info("下单请求处理完毕,【{}】 ", placeOrder);
		}).start();
	}

	public String getCompleteOrder() {
		return completeOrder;
	}

	public void setCompleteOrder(String completeOrder) {
		this.completeOrder = completeOrder;
	}

}
